#include <iostream>

using namespace std;
typedef long long LL;
string s, ret;
LL n;
void dfs(LL pos, LL a, LL b, string s)
{
	if (pos == n)
	{
		if (ret < s) ret = s;
		return;
	}
	LL up = '9' - s[pos], down = s[pos] - '0' + 1;
	if (up <= a || down <= b)
	{
		s[pos] = '9';
		if(up <= a)
			dfs(pos + 1, a - up, b, s);
		if(down <= b)
			dfs(pos + 1, a, b - down, s);
	}
	else
	{
		s[pos] += a;
		dfs(pos + 1, 0, b, s);
	}
	
}
int main()
{
	LL a, b;
	cin >> s >> a >> b;
	n = s.size();
	dfs(0, a, b, s);
	cout << ret << endl;
	return 0;





}





